//    Copyright (C) Kherty.  All rights reserved.
using System;
using System.Windows.Data;
using System.Collections.Generic;

namespace OpenLS.Spreadsheet.UI.Internals
{
    public class IntegerEnumerator: IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            var i = (int) value;
            if (i <= 0)
                return null;
            var result = new List<int>();
            for (int j = 1; j <= i + 1; j++)
            {
                result.Add(j);
            }
            return result;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }
}
